<div ng-controller="StoreCtrl" ng-init="configAction()">
    <ul class="sui-breadcrumb">
        <li><a href="#/store/list">{{'store'|translate}}</a></li>
        <li>{{store.name}}</li>
        <li class="active">
            <!-- <button ng-click="authUrl()" class="sui-btn btn-success">{{'+ 添加小程序'|translate}}</button> -->
            <xiframe get-url="authUrl()" callback="saveAuth(data)" title="+授权"></xiframe>
            <!-- <a href="#/help/wxapp?store_id={{store_id}}">小程序注册流程</a> -->
        </li>
    </ul>

    <storeapps-tab ng-model="Status" click-tab="switchtab()"></storeapps-tab>
    <div ng-show="Status =='guanlian'">
        <table class="sui-table table-bordered">
            <thead>
                <tr>
                    <th>{{'#'|translate}}</th>
                    <th>{{'小程序应用'|translate}}</th>
                    <th>{{'AppId'|translate}}</th>
                    <th>{{'类型'|translate}}</th>
                    <th>{{'Logo'|translate}}</th>
                    <th>{{'发布小程序'|translate}}</th>
                    <th>{{'体验者'|translate}}</th>
                    <th>{{'支付配置'|translate}}</th>
                    <th>{{'二维码'|translate}}</th>
                    <!-- <th>{{'关联门店'|translate}}</th> -->
                    <th>{{'小程序配置'}}</th>
                    <th>{{'微信平台帐号绑定'}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="list in authrizeApp">
                    <td>
                        <input type="checkbox" name="checkbox1" checklist-model="$parent.reomApps"
                            checklist-value="list">
                    </td>
                    <td>
                        {{list.nick_name}}
                        <div>
                            <span ng-if="list.service_type_id==2" class="sui-label label-success">小程序</span>
                            <span ng-if="list.service_type_id==1" class="sui-label label-warning">公众号</span>
                        </div>
                    </td>
                    <td>{{list.app_id}}</td>
                    <td>{{list.principal_name}}</td>
                    <td><img ng-src="{{list.avartar_url}}" style="width: 60px;" /></td>
                    <td ng-if="!list.expires_in" colspan="6" style="color: red;">
                        授权掉线，请重新授权，否则所有功能失效，
                        <xiframe get-url="authUrl()" callback="saveAuth(data)" title="点击这里重新授权"></xiframe>
                    </td>
                    <td ng-if="list.expires_in">
                        <a ng-if="list.service_type_id==2 && list.app_id!=BackAppId"
                            href="#/store/pubcode?store_id={{store_id}}&appid={{list.app_id}}"
                            class="sui-btn btn-primary">{{'上传小程序'|translate}}
                        </a>
                    </td>
                    <td ng-if="list.expires_in">
                        <a ng-if="list.service_type_id==2"
                            href="#/store/tester?store_id={{store_id}}&appid={{list.app_id}}"
                            class="sui-btn btn-success">{{'设置体验者'|translate}}
                        </a>
                    </td>
                    <td ng-if="list.expires_in">
                        <a ng-if="list.app_id!=BackAppId"
                            href="#/store/payconfig?store_id={{store_id}}&appid={{list.app_id}}&cust_account_id={{list.cust_account_id}}"
                            class="sui-btn btn-success">{{'设置支付参数'|translate}}
                        </a>
                    </td>
                    <td ng-if="list.expires_in">
                        <store-qrcode ng-if="list.service_type_id==2" wxappid="list.app_id"></store-qrcode>
                    </td>
                    <td ng-if="list.expires_in">
                        <a ng-if="list.service_type_id==2"
                            href="#/store/baseconfig?store_id={{list.store_id}}&app_id={{list.app_id}}"
                            class="sui-btn btn-primary">{{'小程序配置'|translate}}</a>
                    </td>
                    <td>
                        <a ng-if="list.principal_name !=='个人'" href="#/store/platform?app_id={{list.app_id}}"
                            class="sui-btn btn-success">{{'平台帐号绑定'|translate}}
                        </a>
                    </td>
                </tr>
            </tbody>
        </table>
        <button ng-click="checkAll(1)" class="sui-btn btn-success" ng-show="authrizeApp.length">
            <span ng-show="idtypes">全选</span>
            <span ng-show="!idtypes">反选</span>
        </button>
        <button ng-click="storeappadd($event,1)" class="sui-btn btn-danger" ng-show="reomApps.length">取消关联 </button>
    </div>

    <div ng-show="Status =='wguanlian'">
        <table class="sui-table table-bordered">
            <thead>
                <tr>
                    <th>{{'操作'|translate}}</th>
                    <th>{{'小程序应用'|translate}}</th>
                    <th>{{'AppId'|translate}}</th>
                    <th>{{'类型'|translate}}</th>
                    <th>{{'Logo'|translate}}</th>
                    <th>{{'微信平台帐号绑定'}}</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="list in storeAppList">
                    <td>
                        <input type="checkbox" name="checkbox1" checklist-model="$parent.chosedApps"
                            checklist-value="list">
                    </td>
                    <td>
                        {{list.nick_name}}
                        <div>
                            <span ng-if="list.service_type_id==2" class="sui-label label-success">小程序</span>
                            <span ng-if="list.service_type_id==1" class="sui-label label-warning">公众号</span>
                        </div>
                    </td>
                    <td>{{list.app_id}}</td>
                    <td>{{list.principal_name}}</td>
                    <td><img ng-src="{{list.avartar_url}}" style="width: 60px;" /></td>
                    <td>
                        <a ng-if="list.principal_name !=='个人'" href="#/store/platform?app_id={{list.app_id}}"
                            class="sui-btn btn-success">{{'平台帐号绑定'|translate}}
                        </a>
                    </td>
                </tr>
            </tbody>
        </table>
        <button ng-click="checkAll()" class="sui-btn btn-success" ng-show="storeAppList.length">
            <span ng-show="idtype">全选</span>
            <span ng-show="!idtype">反选</span>
        </button>
        <button ng-click="storeappadd($event)" class="sui-btn btn-success" ng-show="chosedApps.length">设置关联 </button>
    </div>

    <!-- <pager page-no="1" page-size="pageSize" total="storeApp_total_count" get-data="getAllauthrizeApp(pageNo)"></pager> -->
</div>